From f99e0aba70efad0deb907d8e27f09fc9f527c8a4 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 17 Feb 2023 17:07:50 +0700 Subject: Refactor --- src/pages/my/invoice/[id].js | 149 ------------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 src/pages/my/invoice/[id].js (limited to 'src/pages/my/invoice/[id].js') diff --git a/src/pages/my/invoice/[id].js b/src/pages/my/invoice/[id].js deleted file mode 100644 index 820c9af8..00000000 --- a/src/pages/my/invoice/[id].js +++ /dev/null @@ -1,149 +0,0 @@ -import AppBar from "@/components/layouts/AppBar"; -import Layout from "@/components/layouts/Layout"; -import LineDivider from "@/components/elements/LineDivider"; -import WithAuth from "@/components/auth/WithAuth"; -import { useEffect, useState } from "react"; -import apiOdoo from "@/core/utils/apiOdoo"; -import { useRouter } from "next/router"; -import { useAuth } from "@/core/utils/auth"; -import VariantCard from "@/components/variants/VariantCard"; -import currencyFormat from "@/core/utils/currencyFormat"; -import Disclosure from "@/components/elements/Disclosure"; -import DescriptionRow from "@/components/elements/DescriptionRow"; -import { SkeletonList } from "@/components/elements/Skeleton"; -import VariantGroupCard from "@/components/variants/VariantGroupCard"; - -export default function DetailInvoice() { - const router = useRouter(); - const { id } = router.query; - const [ auth ] = useAuth(); - const [ invoice, setInvoice ] = useState(null); - - useEffect(() => { - if (auth && id) { - const loadInvoice = async () => { - const dataInvoice = await apiOdoo('GET', `/api/v1/partner/${auth?.partner_id}/invoice/${id}`); - setInvoice(dataInvoice); - } - loadInvoice(); - } - }, [ auth, id ]); - - const Customer = () => { - const customer = invoice?.customer; - const fullAddress = []; - if (customer?.street) fullAddress.push(customer.street); - if (customer?.sub_district?.name) fullAddress.push(customer.sub_district.name); - if (customer?.district?.name) fullAddress.push(customer.district.name); - if (customer?.city?.name) fullAddress.push(customer.city.name); - - return ( -
- { invoice?.customer?.name } - { invoice?.customer?.email || '-' } - { invoice?.customer?.mobile || '-' } - { fullAddress.join(', ') } -
- ); - }; - - const downloadTaxInvoice = () => { - window.open(`${process.env.ODOO_HOST}/api/v1/download/tax-invoice/${invoice.id}/${invoice.token}`, 'Download') - } - - const downloadInvoice = () => { - window.open(`${process.env.ODOO_HOST}/api/v1/download/invoice/${invoice.id}/${invoice.token}`, 'Download') - } - - return ( - - - - - { invoice ? ( - <> -
- - { invoice?.name } - - - { invoice?.amount_residual > 0 ? ( - Belum Lunas - ) : ( - Lunas - ) } - - - { invoice?.purchase_order_name || '-' } - - - { invoice?.payment_term } - - { invoice?.amount_residual > 0 && invoice.invoice_date != invoice.invoice_date_due && ( - - { invoice?.invoice_date_due } - - ) } - - { invoice?.sales } - - - { invoice?.invoice_date } - -
-

Faktur Pembelian

- -
-
-

Faktur Pajak

- -
-
- - - - - - - - - - - -
- -
-

Total Belanja

-

{ currencyFormat(invoice?.amount_total || 0) }

-
-
- - ) : ( -
- -
- ) } -
-
- ); -} \ No newline at end of file -- cgit v1.2.3